package com.ourhours.message.enums;

/**
 * Description: 短信模板类型.
 *
 * @author wang
 * @version V1.0
 * @since 2017/11/8
 */
public enum SmsTypeEnum {

    REGISTER(1001, "注册" ,"验证码：${1}，5分钟内有效，请勿泄露或转发他人。"),
    LOGIN(1002, "快捷登陆" ,"验证码：${1}，5分钟内有效，请勿泄露或转发他人。"),
    LOST_PASSWORD(1003, "找回密码" ,"验证码：${1}，5分钟内有效，请勿泄露或转发他人。"),
    HOME_DELIVERY(1004, "配送上门" ,"您的订单${1}配送员已收货。配送员电话${2}，如有问题，请联系客服${3}。"),
    CUSTOMER_PICK_UP(1005, "客户自提" ,"您的订单${1}已准备好，请及时提货。如有疑问请联系门店${2}。"),
    ADD_BALANCE(1006, "扣除余额" ,"您账号后四位 的账户，于${1}，支出${2}元，当前账户余额${3}元。如有问题请联系：${4}。"),
    DEL_BALANCE(1007, "增加余额" ,"您账号后四位 的账户，于${1}，账户发生变动，当前账户余额${2}元。如有问题请联系：${3}。");


    private int code;
    private String title;
    private String content;

    SmsTypeEnum(Integer code, String title, String content) {
        this.code = code;
        this.title = title;
        this.content = content;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public static SmsTypeEnum fromCode(Integer type) {
        if (null == type) {
            return null;
        }
        for (SmsTypeEnum smsTypeEnum : values()) {
            if (type == smsTypeEnum.getCode()) {
                return smsTypeEnum;
            }
        }
        return null;
    }
}
